<?php

$basedir = dirname(__FILE__);
require_once $basedir . '/../classes/minime.php';
MiniMe::initialize();

echo "\n\tUsing Test Intaller Scrtip. If you don't know what it does You Should Not Be Really Using This.";

if(mkdir(Minime::$conf['datastore']['user'], 0777, true)) {
    echo "\n\t- Created directory '" . Minime::$conf['datastore']['user'] . "' ...";
    chmod(Minime::$conf['datastore']['user'], 0777);
} else {
    echo "\n\n\tCREATION OF DIRECTORY '" . Minime::$conf['datastore']['user'] . "' WAS NOT SUCCESFULL!";
    echo "\n";
    //exit(400);
}

if (mkdir(Minime::$conf['datastore']['pubsubhubbub_to'], 0777, true)) {
    echo "\n\t- Created directory '" . Minime::$conf['datastore']['pubsubhubbub_to'] . "' ...";
    chmod(Minime::$conf['datastore']['pubsubhubbub_to'], 0777);
} else {
    echo "\n\n\tCREATION OF DIRECTORY '" . Minime::$conf['datastore']['pubsubhubbub_to'] . "' WAS NOT SUCCESFULL!";
    echo "\n";
    //exit(400);
}

if (mkdir(Minime::$conf['datastore']['pubsubhubbub_from'], 0777, true)) {
    echo "\n\t- Created directory '" . Minime::$conf['datastore']['pubsubhubbub_from'] . "' ...";
    chmod(Minime::$conf['datastore']['pubsubhubbub_from'], 0777);
} else {
    echo "\n\n\tCREATION OF DIRECTORY '" . Minime::$conf['datastore']['pubsubhubbub_from'] . "' WAS NOT SUCCESFULL!";
    echo "\n";
    //exit(400);
}

echo "\n\n\tDONE! All Good to go.\n\n";

passthru('php setup/createuser.php user-a "User A" "User A\'s Microblog" "A Stuff"');
passthru('php setup/createuser.php user-b "User B" "User B\'s Microblog" "B Stuff"');
passthru('php setup/createuser.php user-c "User C" "User C\'s Microblog" "C Stuff"');
passthru('php setup/subscribeuser.php user-a "acct:user-b@localhost"');
passthru('php setup/subscribeuser.php user-a "acct:user-c@localhost"');
passthru('php setup/subscribeuser.php user-b "acct:user-c@localhost"');
passthru('php setup/blog.php user-c "Wow, coolness. USER-C is so cool."');
passthru('php setup/blogto.php user-a "http://localhost/index.php?controller=profile&username=user-c" "@user-c No, user-a is! :-)"');
passthru('php setup/blogto.php user-c "http://localhost/index.php?controller=profile&username=user-a" "@user-A No, user-C is! :-)"');
